package com.bytedance.social.controller;

import com.bytedance.social.request.FollowListRequest;
import com.bytedance.social.request.FollowerListRequest;
import com.bytedance.social.request.FriendListRequest;
import com.bytedance.social.request.RelationActionRequest;
import com.bytedance.social.respones.FollowListResponse;
import com.bytedance.social.respones.FollowerListResponse;
import com.bytedance.social.respones.FriendListResponse;
import com.bytedance.social.respones.RelationActionResponse;
import com.bytedance.social.service.RelationService;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;

@RestController
@Slf4j
@RequestMapping("/douyin/relation")
public class RelationController {

    @Autowired
    private RelationService relationService;

    @PostMapping("/action")
    public RelationActionResponse relationAction(RelationActionRequest relationActionRequest) {
        RelationActionResponse relationActionResponse = relationService.relationAction(relationActionRequest);
        return relationActionResponse;
    }

    @GetMapping("/follow/list")
    public FollowListResponse getUserFollowList(FollowListRequest followListRequest) {
        FollowListResponse followListResponse = relationService.getUserFollowList(followListRequest);
        return followListResponse;
    }

    @GetMapping("/follower/list")
    public FollowerListResponse getUserFollowerList(FollowerListRequest followerListRequest) {
        FollowerListResponse followerListResponse = relationService.getUserFollowerList(followerListRequest);
        return followerListResponse;
    }

    @GetMapping("/friend/list")
    public FriendListResponse getUserFriends(FriendListRequest friendListRequest) throws ParseException {
        FriendListResponse friendListResponse = relationService.getUserFriends(friendListRequest);
        return friendListResponse;
    }


}
